package xp.ass.imitate.express.meta.node;

import lombok.Data;
import xp.ass.imitate.express.impl.XExpressState;

/**
 * @author chent3
 * @date 2024/9/5
 */
@Data
public class VariableTokenNode extends XTokenNode {

    // #user.name ==> variableName = #user
    private String variableName;

    public VariableTokenNode(String variableName, int pos) {
        super(pos);
        this.variableName = variableName;
    }

    @Override
    public Object getValue(XExpressState state) {
        return state.getContext().lookupVariable(this.variableName);
    }
}
